package org.nanotek.dao.spring.impl;

import java.util.List;

import org.nanotek.Base;
import org.nanotek.dao.DAO;
import org.nanotek.dao.DAOException;
import org.nanotek.dao.spring.BaseDAO;
import org.springframework.dao.DataAccessException;

public class GeneralPurposeDAO extends BaseDAO implements DAO<Base<?>> {

	public GeneralPurposeDAO() {}

	public Base<?> findById (String id)
	{ 
		return getHibernateTemplate().get(clazz, id);
	}

	@Override
	public List<Base<?>> listRecords(Integer firstResult, Integer maxResults) {
		try {
			return getHibernateTemplate().findByExample(getClazz().newInstance() , firstResult, maxResults);
		} catch (DataAccessException | InstantiationException
				| IllegalAccessException e) {
			throw new DAOException(e);
		}
	}
	
	
}
